from colorama import *
#~ from termcolor import *
import sys
init()
import enum
import enum
class Style(enum.IntEnum):
    reset_all       =  0 #[<AnsiStyle.RESET_ALL: 0>]
    bold            =  1 #[<AnsiStyle.BRIGHT: 1>, <attributes.bold: 1>]
    dark            =  2 #[<AnsiStyle.DIM: 2>, <attributes.dark: 2>]
    italic          =  3 #
    underline       =  4 #[<attributes.underline: 4>]
    blink           =  5 #[<attributes.blink: 5>]
    blink_rapid     =  6 #
    negative        =  7 # inverse ; swap foreground and background
    concealed       =  8 #[<attributes.concealed: 8>]
    crossed_out     =  9
    underline_double= 21
    normal          = 22 #[<AnsiStyle.NORMAL: 22>]
class Foreground(enum.IntEnum):
    black           = 30 #[<AnsiFore.BLACK: 30>, <colors.grey: 30>]
    red             = 31 #[<AnsiFore.RED: 31>, <colors.red: 31>]
    green           = 32 #[<AnsiFore.GREEN: 32>, <colors.green: 32>]
    yellow          = 33 #[<AnsiFore.YELLOW: 33>, <colors.yellow: 33>]
    blue            = 34 #[<AnsiFore.BLUE: 34>, <colors.blue: 34>]
    magenta         = 35 #[<AnsiFore.MAGENTA: 35>, <colors.magenta: 35>]
    cyan            = 36 #[<AnsiFore.CYAN: 36>, <colors.cyan: 36>]
    white           = 37 #[<AnsiFore.WHITE: 37>, <colors.white: 37>]
    default         = 39 #[<AnsiFore.RESET: 39>]
    #extensions
    lightblack_ex   = 90 #[<AnsiFore.LIGHTBLACK_EX: 90>]
    lightred_ex     = 91 #[<AnsiFore.LIGHTRED_EX: 91>]
    lightgreen_ex   = 92 #[<AnsiFore.LIGHTGREEN_EX: 92>]
    lightyellow_ex  = 93 #[<AnsiFore.LIGHTYELLOW_EX: 93>]
    lightblue_ex    = 94 #[<AnsiFore.LIGHTBLUE_EX: 94>]
    lightmagenta_ex = 95 #[<AnsiFore.LIGHTMAGENTA_EX: 95>]
    lightcyan_ex    = 96 #[<AnsiFore.LIGHTCYAN_EX: 96>]
    lightwhite_ex   = 97 #[<AnsiFore.LIGHTWHITE_EX: 97>]
class Background(enum.IntEnum):
    black           = 40 #[<AnsiBack.BLACK: 40>, <highlights.grey: 40>]
    red             = 41 #[<AnsiBack.RED: 41>, <highlights.red: 41>]
    green           = 42 #[<AnsiBack.GREEN: 42>, <highlights.green: 42>]
    yellow          = 43 #[<AnsiBack.YELLOW: 43>, <highlights.yellow: 43>]
    blue            = 44 #[<AnsiBack.BLUE: 44>, <highlights.blue: 44>]
    magenta         = 45 #[<AnsiBack.MAGENTA: 45>, <highlights.magenta: 45>]
    cyan            = 46 #[<AnsiBack.CYAN: 46>, <highlights.cyan: 46>]
    white           = 47 #[<AnsiBack.WHITE: 47>, <highlights.white: 47>]
    default         = 49 #[<AnsiBack.RESET: 49>]

    lightblack_ex   =100 #[<AnsiBack.LIGHTBLACK_EX: 100>]
    lightred_ex     =101 #[<AnsiBack.LIGHTRED_EX: 101>]
    lightgreen_ex   =102 #[<AnsiBack.LIGHTGREEN_EX: 102>]
    lightyellow_ex  =103 #[<AnsiBack.LIGHTYELLOW_EX: 103>]
    lightblue_ex    =104 #[<AnsiBack.LIGHTBLUE_EX: 104>]
    lightmagenta_ex =105 #[<AnsiBack.LIGHTMAGENTA_EX: 105>]
    lightcyan_ex    =106 #[<AnsiBack.LIGHTCYAN_EX: 106>]
    lightwhite_ex   =107 #[<AnsiBack.LIGHTWHITE_EX: 107>]


def _colored(*args, colors=[],reset=True,sep=' '):
    ret=sep.join([str(i) for i in args])

    fmt_str = '\033[%sm' % (';'.join([str(int(i) ) for i in colors]))
    reset='\033[%dm' % Style.reset_all
    return fmt_str + ret + reset
colored=_colored
def cprint(*args,colors=[],reset=True,sep=' ', **kwargs):
    string=colored(*args,colors=colors,reset=reset,sep=sep)
    print(string,**kwargs)


